package com.example.study.state;

import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * 状态模式<br>
 * 
 * @author lli
 *
 * @version 1.0
 *
 */
public class Test {

    public static void main(String[] args) {
        ExecutorService ex = Executors.newFixedThreadPool(3);
        for (int i = 0; i < 3; i++) {
            ex.execute(new Runnable() {

                @Override
                public void run() {
                    test(UUID.randomUUID().toString());

                }
            });
        }

        ex.shutdown();

    }

    /**
     * @description
     * @author lli
     * @create 2017年6月2日下午9:19:47
     * @version 1.0
     */
    private static void test(String id) {
        Context context = new Context(id);
        context.startSession();
        context.writeAndGet();
        context.endSession();
    }

}
